package com.yuan.pay_mall;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//url拦截器
//用户登录拦截器配置文件
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    //默认对所有的url拦截
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserLoginInterceptor())
                .addPathPatterns("/**") //拦截所有url
                .excludePathPatterns("/user/login","/user/register","/categories",
                        "/products","/products/*","/error");//这些地址不拦截
    }
}


